package org.ljy.springblog.config;

import lombok.extern.slf4j.Slf4j;
import org.ljy.springblog.model.Result;
import org.springframework.web.bind.annotation.RestControllerAdvice;
//统一返回异常--发生异常的情况

@Slf4j
@RestControllerAdvice
public class ExceptionAdvice {

    public Result headler(Exception e) {
        log.error("发生异常，e:"+e);
        return Result.fail(e.getMessage());
    }
    public Result header(UnsupportedOperationException e) {
        log.error("发生异常，e:"+e);
        return Result.fail(e.getMessage());
    }
}
